package part2;

public class WarGame {
	Agent player1;
	Agent player2;
	Board b;
	
	public WarGame(Agent player1, Agent player2, String boardName){
		this.player1 = player1;
		this.player2 = player2;
		b = new Board(boardName);
	}
	boolean isP1turn = true;
	public void runMove(){
		if(isP1turn){
			player1.makeMove(b);
		}
		else{
			player2.makeMove(b);
		}
		isP1turn = !isP1turn;
	}
	public void runGame(){
		boolean isP1turn = true;
		//int k = 1;
		while(!b.isFull()){
		//for(int i=0; i<2; i++) {
			
			if(isP1turn){
				player1.makeMove(b);
			}
			else{
				player2.makeMove(b);
			}
			isP1turn = !isP1turn;
			b.print();
		}
		int oneScore = b.calcTotals()[player1.color];
		int twoScore = b.calcTotals()[player2.color];

		System.out.println("Player1 Score: "+oneScore+" Player2 Score: "+twoScore);
	}
	
	public static void main(String[] args){
		WarGame w = new WarGame( new AlphaBetaAgent(1),  new MinMaxMKII(2), "Keren.txt");
		//WarGame w = new WarGame(new MiniMaxAgent(1), new MiniMaxAgent(2), "Narvik.txt");
		w.runGame();
	}
}
